import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
	// data
	state:{
		userInfo:{},
		needAuth:true,
		isLogin:false
	},
	// computed
	getters:{
		getUserInfo(state){
			return state.userInfo
		},
		getNeedAuth(state){
			return state.needAuth
		},
		getIsLogin(state){
			return state.isLogin
		}
	
	},
	// methods 同步
	mutations:{
		setUserInfo(state,userInfo){
			state.userInfo = userInfo
		},
		setNeedAuth(state,needAuth){
			state.needAuth = needAuth
		},
		setIsLogin(state,isLogin){
			state.isLogin = isLogin
		}
	},
	// 异步的方法
	actions:{}
})

export default store